<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 客服接口
 */
class Customer extends Api
{
    protected $noNeedLogin = ['index'];
    protected $noNeedRight = ['*'];

    public function index()
    {
        if ($this->request->isPost()) {
            $pageIndex = $this->request->post('pageIndex', 1);
            $pageSize = $this->request->post('pageSize', 10);
            // 查询推荐的产品
            $list = model('\app\admin\model\jy\Customer')
                ->where(['status' => 1])
                ->order('update_time desc')
                ->paginate($pageSize, false, ['page' => $pageIndex]);
            foreach ($list as &$row) {
                $row['avatar'] = cdnurl($row['avatar']);
                $row['qrcode'] = cdnurl($row['qrcode']);
            }
            $result = array("total" => $list->total(), "rows" => $list->items());
            $this->success('', $result);
        }
    }
}
